    /*
     * HibernateUtil.java
     *
     * Created on April 18, 2007, 12:17 PM
     *
     * To change this template, choose Tools | Template Manager
     * and open the template in the editor.
     */

package org.wii.jadwal.model;


import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 *
 * @author Hendro
 */
public class HibernateUtil {
    private static final SessionFactory sessionFactory;
    static{
        try{
            sessionFactory = new Configuration().configure().buildSessionFactory();
        }catch(Throwable ex){
            System.err.println("Initial SessionFactory failed. "+ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
    public static SessionFactory getSessionFactory(){
        return sessionFactory;
    }
    public static Session getCurrentSession(){
        return getSessionFactory().getCurrentSession();
    }
}
